/* Eshm - SHM abstraction
 * Copyright (C) 2008-2012 Jorge Luis Zapata
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 * If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef ESHM_PRIVATE_H_
#define ESHM_PRIVATE_H_

#include <string.h>
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#include <sys/ipc.h>
#include <sys/shm.h>

#define ERR(...) EINA_LOG_DOM_ERR(eshm_log_dom, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(eshm_log_dom, __VA_ARGS__)
#define WRN(...) EINA_LOG_DOM_WARN(eshm_log_dom, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(eshm_log_dom, __VA_ARGS__)

extern int eshm_log_dom;

typedef void (*Eshm_Segment_Free)(void *data);
typedef void *(*Eshm_Segment_Map_Get)(void *data);

typedef struct _Eshm_Segment_Descriptor
{
	Eshm_Segment_Map_Get map_get;
	Eshm_Segment_Free free;
} Eshm_Segment_Descriptor;

Eshm_Segment * eshm_segment_new(Eshm_Segment_Descriptor *d, size_t size, void *data);
void * eshm_segment_data_get(Eshm_Segment *s);

#endif /*ESHM_PRIVATE_H_*/
